home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12443 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Looking for semaphore example.
  5. Date: 31 Mar 1996 01:25:08 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4jlc0k$j02@solutions.solon.com>
  8. References: <4jc5hd$1vlv@ilx018.iil.intel.com> <828220289snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <828220289snz@genesis.demon.co.uk>,
  12. Lawrence Kirby  <fred@genesis.demon.co.uk> wrote:
  13. >>Hi - 
  14. >>I'm looking for a simple example of implementation of semaphore in C .
  15.  
  16. >Not possible - the C language doesn't support semaphores. You'll have
  17. >to go beyond the C language to get this.
  18.  
  19. Nonsense!  You'll just need to go beyond the C language to implement
  20. semaphores in a useful or meaningful way.  :)  You could easily implement
  21. a semaphore algorithm in C, it just wouldn't matter in pure C, because
  22. you'd only ever have the one process.
  23.  
  24. Unless you wanted to implement software-level coprocesses or the like,
  25. which you could do.
  26.  
  27. >>Nothing fancy - just the very basic kind: need to keep one child process
  28. >>from reading/writing a common file when a 2nd process is dealing with
  29. >>that file.
  30.  
  31. This, of course, is impossible in C, although you could study the logic
  32. by writing emulation of multiple processes in C.
  33.  
  34. >You need to system specific facilities provided by your implemenation.
  35. >Those are probably Unix specific in this case so try comp.unix.programmer.
  36.  
  37. Yes, conveniently, all the hooks are there, and it would be much faster to do
  38. this in Unix than in C.
  39.  
  40. -s
  41. -- 
  42. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  43. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  44. FUCK the communications decency act.  Goddamned government.  [literally.]
  45. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  46.